import 'package:earclean/app/config/colors.dart';
import 'package:earclean/app/modules/widget/app_bar_widget.dart';
import 'package:earclean/app/modules/widget/login_button.dart';
import 'package:earclean/app/routes/app_pages.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import 'package:get/get.dart';

import '../controllers/gokefu_controller.dart';

class GokefuView extends GetView<GokefuController> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: const AppBarWidget(
          backgroundColor: ColorConfig.white, titleStr: '客服'),
      body: Column(
        children: [
          SizedBox(
            height: 1,
          ),
          Obx(()=>cellWidget('assets/images/客服热线.png', '客服电话', controller.kefu.value)),
          Spacer(),
          Container(
            width: 1.sw,
            height: 45,
            margin: EdgeInsets.symmetric(horizontal: 30.w),
            child: LoginButton(
              "在线客服",
              enable: true,
              onPressed: () {
                Get.toNamed(Routes.CHAT);
              },
            ),
          ),
          SizedBox(height: 30)
        ],
      ),
    );
  }

  Widget cellWidget(String img, String title, String subtitle) {
    return Container(
      padding: EdgeInsets.symmetric(vertical: 13.5.h, horizontal: 20),
      color: ColorConfig.white,
      child: Row(
        children: [
          Image.asset(
            img,
            width: 30,
            height: 30,
          ),
          SizedBox(
            width: 15.w,
          ),
          Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text(title,
                  style: TextStyle(
                      fontSize: 15,
                      color: Color(0xFF1C2023),
                      fontWeight: FontWeight.w400)),
              Text(subtitle,
                  style: TextStyle(
                      fontSize: 12,
                      color: Color(0xFF606972),
                      fontWeight: FontWeight.w400)),
            ],
          ),
        ],
      ),
    );
  }
}
